package gutil

import (
	"bytes"
	"github.com/mozillazg/go-pinyin"
)

func PyFirstChar(cnStr string) (firstChars string) {
	// 默认
	a := pinyin.NewArgs()
	rows := pinyin.Pinyin(cnStr, a)
	//fmt.Println(rows)
	for i := 0; i < len(rows); i++ {
		if len(rows[i]) != 0 {
			str := rows[i][0]
			pi := str[0:1]
			firstChars += string(bytes.ToUpper([]byte(pi)))
		}
	}
	return
}
